# coding=utf-8
import random
from time import sleep

import redis


class CONFIG:
    HOST = '111.231.201.108'
    PORT = '16379'
    PASSWORD = 'root'
    DB = 1


# 对于每一个Redis服务器，用户只需要创建一个conn对象
conn = redis.Redis(host=CONFIG.HOST, port=CONFIG.PORT, password=CONFIG.PASSWORD, db=CONFIG.DB)


def get_imei_list(start, step):
    return [start + item for item in range(step)]


tmplate = '"{' \
          '\\"autoDownload\\":1,' \
          '\\"count\\":1,' \
          '\\"createTime\\":1610523290881,' \
          '\\"fromV\\":\\"Huddle XS 4G LTE.B06\\",' \
          '\\"id\\":0,' \
          '\\"imei\\":\\"%s\\",' \
          '\\"operator\\":2,' \
          '\\"product\\":\\"ytl_wewins_mf25_mf683s_v31_21\\",' \
          '\\"reqServer\\":\\"14.1.206.128\\",' \
          '\\"respServer\\":\\"fota-china.we-wins-cd.com\\",' \
          '\\"toV\\":\\"Huddle XS 4G LTE.B09\\",' \
          '\\"updateTime\\":0' \
          '}"'

imei_list = get_imei_list(354972064379664, 3001)
# conn.lpush('fota:log:queue', tmplate % imei_list[random.randint(0, 499)])
for i in range(100000):
    # sleep(random.randint(1, 5000)/1000)
    print(i)
    conn.lpush('fota:log:queue', tmplate % imei_list[random.randint(0, 3000)])
print('finish.....')
